Expose Wasi-TLS handshake error#10429
Conversation
…roperly propagated into the guest.
| let this = &mut self.table.get_mut(&this)?.0; | ||
| match this { | ||
| StreamState::Pending(_) => return Ok(None), | ||
| StreamState::Closed => return Ok(Some(Err(()))), |
There was a problem hiding this comment.
should we be return some information about the stream being closed with this error?
There was a problem hiding this comment.
| Ok(s) => s, | ||
| Err(TlsError::Trap(e)) => return Err(e), | ||
| Err(TlsError::Io(e)) => { | ||
| let error = self.table.push(e)?; |
There was a problem hiding this comment.
do we need logic to clean up these table entries?
There was a problem hiding this comment.
You mean the table entries for the newly created wasi:io/error resources? The ownership of these resource is transferred into the guest one line below it. It's then the responsibility of the guest to drop it properly like any other resource. When the guest drops that resource, wasmtime removes it from the table in https://github.com/bytecodealliance/wasmtime/blob/main/crates/wasi-io/src/impls.rs#L114-L116
There was a problem hiding this comment.
thanks for the explanation
|
I've updated |
jsturtevant
left a comment
There was a problem hiding this comment.
LGTM, Thanks for the updates
Implements WebAssembly/wasi-tls#10
And added a test case to verify the error information is indeed reaching the guest.
PR is still draft, because above issue needs to be merged first. But feel free to review the design & implementation already.CC @jsturtevant